package model.preprocessor;

import controller.preprocessor.Hypre;

/**
 * Class for managing of {@link Hypre} parameter.
 * 
 * @author GRONOWSKI Stephane svan001@aol.com
 * 
 *         igsat 2010
 * 
 */
public class HypreParameter extends PreProcessorParameter {

	/** value "not used" for a parameter */
	public static final int	NOT_USED		= -4;
	/** minimal value of verbosity parameter */
	public static final int	MIN_VERBOSITY	= 0;
	/** maximal value of verbosity parameter */
	public static final int	MAX_VERBOSITY	= 3;

	private int				verbosity		= NOT_USED;

	/**
	 * 
	 * @return the verbosity.
	 */
	public int getVerbosity() {
		return verbosity;
	}

	/**
	 * Set the verbosity parameter.
	 * 
	 * @param verbosity
	 *            new value.
	 * @return if it works.
	 */
	public boolean setVerbosity(int verbosity) {
		if (verbosity != NOT_USED && (verbosity > MAX_VERBOSITY || verbosity < MIN_VERBOSITY))
			return false;

		this.verbosity = verbosity;
		return true;
	}

	@Override
	public boolean basicCheck() {
		if (!super.basicCheck())
			return false;

		if (verbosity != NOT_USED && (verbosity > MAX_VERBOSITY || verbosity < MIN_VERBOSITY))
			return false;

		return true;
	}

	/**
	 * Create new parameter for {@link Hypre};
	 * 
	 * @param out
	 *            the output file.
	 */
	public HypreParameter(String out) {
		super(out);
	}

	/**
	 * Create new parameter for {@link Hypre};
	 */
	public HypreParameter() {
	}

}
